﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuanLyNhaSach.DataAccessLayer
{
    public class PhieuThuDAO
    {
        DataConnection dt_con = new DataConnection();
        public DataTable XemPhieuThu(string mahoadon)
        {
            string cmd = "exec PHIEUTHU_Get '{0}'";
            return dt_con.Read(String.Format(cmd, mahoadon));
        }

        public void ThemPhieuThu(string mahoadon, string ngaythu, string sotienthu)
        {
            string cmd = "exec PHIEUTHU_Insert '{0}','{1}','{2}'";
            dt_con.Write(String.Format(cmd, mahoadon, ngaythu, sotienthu));
        }
        public DataTable LayPhieuThu(String a)
        {
            string cmd = "exec PHIEUTHU_Get'"+a+"'";
            return dt_con.Read(String.Format(cmd, a));
        }
        public DataTable LayPhieuThuTheoThang(string datetime)
        {
            string cmd = "exec PHIEUTHU_GetforMonth '"+datetime+"'";
            return dt_con.Read(cmd);
        }
        public DataTable LayTatCaPhieuThu()
        {
            return dt_con.Read("exec PHIEUTHU_GetAll");
        }        
    }
}
